package autotd;

public final class Elements {
  // The following prefixes may be applied prior to an
  // an elemental type to alter the severity of the effect.
  // For example, a monster with type "Major-Light" would
  // take very little damage from any Light based tower.
  // By default a lack of prefix => moderate.

  public static final String MINOR = "Minor";
  public static final String MODERATE = "Moderate";
  public static final String MAJOR = "Major";
  public static final String SEPARATOR = "-";

  public static final String EARTH = "Earth";
  public static final String WIND = "Wind";
  public static final String FIRE = "Fire";
  public static final String WATER = "Water";
  public static final String LIGHT = "Light";
  public static final String DARK = "Dark";

  public static final String STUN = "Stun";
  public static final String SLOW = "Slow";
  public static final String HASTE = "Haste";
  public static final String CURSE = "Curse";


  public static boolean isElementalType(String tag) {
    return tag.endsWith(EARTH) || tag.endsWith(WIND) || tag.endsWith(FIRE) || tag.endsWith(WATER) || tag.endsWith(LIGHT) || tag.endsWith(DARK);
  }

  public static boolean isEffectType(String tag) {
    return tag.endsWith(STUN) || tag.endsWith(SLOW) || tag.endsWith(HASTE) || tag.endsWith(CURSE);
  }

  public static String getBaseType(String tag) {
    if (tag.indexOf(SEPARATOR) > -1) {
      return tag.substring(tag.indexOf(SEPARATOR) + SEPARATOR.length(), tag.length());
    } else {
      return tag;
    }
  }

  public static String getSeverity(String tag) {
    if (tag.startsWith(MINOR)) {
      return MINOR;
    } else if (tag.startsWith(MAJOR)) {
      return MAJOR;
    } else {
      return MODERATE;
    }
  }

}